package com.squirrel.serialportcore.common;

/**
 * 串口属性配置
 *
 * @author Squbi
 * @date 2021/3/20 11:28
 */
public class SerialPortProperties {

    /**
     * bitRate 比特率
     * dataBits 数据位
     * stopBits 停止位
     * checkType 检查方法 {@link gnu.io.SerialPort}
     *
     * @author Squbi
     * @date 2021/3/20 11:38
     */
    private int bitRate = 9600;
    private int dataBits = 8;
    private int stopBits = 1;
    private int checkParity = 0;

    public int getBitRate() {
        return bitRate;
    }

    public SerialPortProperties setBitRate(int bitRate) {
        this.bitRate = bitRate;
        return this;
    }

    public int getDataBits() {
        return dataBits;
    }

    public SerialPortProperties setDataBits(int dataBits) {
        this.dataBits = dataBits;
        return this;
    }

    public int getStopBits() {
        return stopBits;
    }

    public SerialPortProperties setStopBits(int stopBits) {
        this.stopBits = stopBits;
        return this;
    }

    public int getCheckParity() {
        return checkParity;
    }

    public SerialPortProperties setCheckParity(int checkParity) {
        this.checkParity = checkParity;
        return this;
    }

    @Override
    public String toString() {
        return "SerialPortProperties{" +
                "bitRate=" + bitRate +
                ", dataBits=" + dataBits +
                ", stopBits=" + stopBits +
                ", checkParity=" + checkParity +
                '}';
    }
}
